--------------------------------------------------------------------
      name:  <unnamed>
       log:  /home/dcohen/work/202410_rents_replication/logs/01-02.l
> og
  log type:  text
 opened on:  18 Oct 2024, 14:17:44

. 
. ******************************************************************
> **************
. *** SETUP
. ******************************************************************
> **************
. 
. * Specify version
. version 15

. clear all 

. set maxvar 7500


. 
. * Set global macro for input and output paths
. global longpath "/home/dcohen/soep-data/soep.v35/stata_de+en/"

. global savepath "/home/dcohen/work/202410_rents_replication//dat/p
> roc-data/"

. 
. ******************************************************************
> **************
. *** Merge Data Sets
. ******************************************************************
> **************
. 
. * Regional indicators (REGIONL)
. use "$longpath/regionl.dta", clear
(REGIONL: Sep 08, 2016 14:44:59-1 DBV32)

. keep hid syear bula gtyp bik gkz kkz plz kr_kkz kr_kkz_rek

. 
. * Merge with all variables from MICROM
. merge 1:1 hid syear using "$longpath/microm.dta"
(variable syear was int, now long to accommodate using data's
       values)

    Result                      Number of obs
    -----------------------------------------
    Not matched                       165,970
        from master                   165,838  (_merge==1)
        from using                        132  (_merge==2)

    Matched                           360,754  (_merge==3)
    -----------------------------------------

. keep if syear >= 2005 & _merge == 3
(235,307 observations deleted)

. drop _merge

. 
. * Drop irrelevant variables
. drop ha_mfi* ha_mgs* ha_mlo* ha_mlt* ha_mmi* ha_mmm_p_* ha_mph_* h
> a_mpi_* ///
>      ha_mpm_* ha_mps_* ha_mty_* ha_tfi_* ha_tfr_* ha_tgl_* ha_tgw_
> * ha_thf_* ///
>      ha_tko_* ha_tme_* ha_tmo_* ha_wev_* ha_dug_* ha_mfi_* ha_mgm_
> * ha_mlp_p_* ///
>      mz_mgm_* mz_mgs_* mz_mlp_p_* mz_mlt_* mz_mmi_* mz_mmm_p_* mz_
> mpm_* mz_mty_* ///
>      mz_wev_* ///
>      p8_mgm_* p8_mgs_* p8_mlp_p_* p8_mlt_* p8_mmi_* p8_mmm_p_* p8_
> mpm_* p8_mty_* ///
>      p8_wev_* p8_dug_* ///
>      st_mgm_* st_mgs_* st_mlp_p_* st_mlt_* st_mmi_* st_mmm_* st_mp
> m_* st_mty_* ///
>      st_wev_* st_dug_*

.      
. * Drop variables at the house and street level; keep neighborhoods
>  (mz, p8)
. drop st_*

. unab ha_vars: ha_*

. loc exclude "ha_mso_k_status"

. foreach var in `:list ha_vars - exclude' {
  2.   drop `var'
  3. }

. 
. * Drop variables at the neighboorhood level with high missingness
. drop mz_ewa* mz_mba* mz_reg* ///
>      p8_ewa* p8_mba* mz_reg* ///
>      id_* kr_id ///
>      p8_p8t_w_flaeche t_mz_kkr_w_summe t_st_kkr_w_summe gk_reg_k_r
> st17

. 
. * Recode missings
. global regionl_vars = "gtyp-kr_kkz_rek"

. mvdecode $regionl_vars, mv(-1 -2 -3 = . \ -5 = .a\ -8 = .b)
        gtyp: 1217 missing values generated
         bik: 1240 missing values generated
         gkz: 1171 missing values generated
         kkz: 1174 missing values generated
         plz: 33 missing values generated
      kr_kkz: 1174 missing values generated
  kr_kkz_rek: 1174 missing values generated

. 
. global microm_vars = "micyear-p8_erp_p_ewlose "

. mvdecode $microm_vars, mv(-1 -2 -3 = . \ -5 = .a\ -8 = .b)
     micyear: 8497 missing values generated
        hhnr: 29196 missing values generated
     sample1: 137915 missing values generated
  returncode: 16 missing values generated
        wein: 126382 missing values generated
kr_zrc_k_c~r: 68675 missing values generated
         ort: string variable ignored
       mz_id: 171503 missing values generated
       gk_id: 447 missing values generated
       pl_id: 447 missing values generated
       p8_id: 69667 missing values generated
gk_reg_k_g~p: 453 missing values generated
gk_reg_k_o~e: 453 missing values generated
gk_kon_p_e~l: 29685 missing values generated
gk_kon_p_r~h: 29685 missing values generated
gk_kon_p_s~e: 29685 missing values generated
ha_mso_k_s~s: 9606 missing values generated
mz_alq_k_q~e: 226395 missing values generated
mz_alq_i_q~d: 226394 missing values generated
mz_alq_i_q~o: 226394 missing values generated
mz_alq_p_q~e: 226394 missing values generated
mz_ewg_a_g~t: 275170 missing values generated
mz_ewg_a_m~l: 226376 missing values generated
mz_ewg_a_w~h: 226376 missing values generated
mz_kkr_k_k~d: 239664 missing values generated
mz_kkr_k_k~o: 239664 missing values generated
mz_kkr_~wbrd: 171557 missing values generated
mz_kkr_~hbrd: 239664 missing values generated
mz_kkr_i~hwo: 239664 missing values generated
mz_kkr_i~wwo: 171557 missing values generated
mz_kkr_w_p~w: 239664 missing values generated
mz_kkr_w_p~h: 171557 missing values generated
mz_kkr_w_p~e: 171560 missing values generated
mz_kkr_w_s~e: 171557 missing values generated
mz_met_p_a~a: 186250 missing values generated
mz_met_p_a~n: 186250 missing values generated
mz_met_p_b~n: 186250 missing values generated
mz_met_p_d~l: 186250 missing values generated
mz_met_p_g~n: 186250 missing values generated
mz_met_p_i~m: 186250 missing values generated
mz_met_p_i~n: 186250 missing values generated
mz_met_p_o~p: 186250 missing values generated
mz_met_p_s~s: 186250 missing values generated
mz_met_p_s~t: 186250 missing values generated
mz_met_p_t~i: 186250 missing values generated
mz_met_p_u~e: 186250 missing values generated
mz_mlp_k_l~e: 265179 missing values generated
mz_mlp_k_s~p: 265179 missing values generated
mz_mmm_k_d~g: 239664 missing values generated
mz_mmm_w_m~h: 239647 missing values generated
mz_mmo_k_f~l: 171568 missing values generated
mz_mmo_k_f~u: 171568 missing values generated
mz_mmo_k_n~e: 171568 missing values generated
mz_mmo_k_s~o: 171568 missing values generated
mz_mmo_k_v~n: 171568 missing values generated
mz_muc_p_a~k: 239586 missing values generated
mz_mzt_k_m~e: 185059 missing values generated
mz_mzt_k_m~p: 185262 missing values generated
p8_alq_k_q~e: 69667 missing values generated
p8_alq_i_q~d: 69667 missing values generated
p8_alq_i_q~o: 69667 missing values generated
p8_alq_p_q~e: 69667 missing values generated
p8_ewg_a_m~l: 69667 missing values generated
p8_ewg_a_w~h: 69667 missing values generated
p8_kkr_k_k~d: 69667 missing values generated
p8_kkr_k_k~o: 69667 missing values generated
p8_kkr_~wbrd: 69667 missing values generated
p8_kkr_~hbrd: 69667 missing values generated
p8_kkr_i~hwo: 69667 missing values generated
p8_kkr_i~wwo: 69667 missing values generated
p8_kkr_w_p~w: 69667 missing values generated
p8_kkr_w_p~h: 69667 missing values generated
p8_kkr_w_p~e: 69667 missing values generated
p8_kkr_w_s~e: 69667 missing values generated
p8_met_p_a~a: 69606 missing values generated
p8_met_p_a~n: 69606 missing values generated
p8_met_p_b~n: 69606 missing values generated
p8_met_p_d~l: 69606 missing values generated
p8_met_p_g~n: 69606 missing values generated
p8_met_p_i~m: 69606 missing values generated
p8_met_p_i~n: 69606 missing values generated
p8_met_p_o~p: 69606 missing values generated
p8_met_p_s~s: 69606 missing values generated
p8_met_p_s~t: 69606 missing values generated
p8_met_p_t~i: 69606 missing values generated
p8_met_p_u~e: 69606 missing values generated
p8_mlp_k_l~e: 95195 missing values generated
p8_mlp_k_s~p: 95195 missing values generated
p8_mmm_k_d~g: 69667 missing values generated
p8_mmm_w_m~h: 69904 missing values generated
p8_mmo_k_f~l: 69667 missing values generated
p8_mmo_k_f~u: 69667 missing values generated
p8_mmo_k_n~e: 69667 missing values generated
p8_mmo_k_s~o: 69667 missing values generated
p8_mmo_k_v~n: 69667 missing values generated
p8_muc_p_a~k: 121444 missing values generated
p8_p8t_k_p~p: 121444 missing values generated
p8_p8t_k_p~e: 121444 missing values generated
p8_mwo_p_e~m: 189294 missing values generated
p8_mwo_p_m~r: 189294 missing values generated
p8_erp_a_e~n: 189294 missing values generated
p8_erp_p_~ge: 189294 missing values generated
p8_erp_p_~se: 189294 missing values generated

. 
. foreach X of varlist $microm_vars {
  2.   if(inlist("`: type `X''", "int", "double", "byte", "long")) {
  3.     tab `X' if `X' == 0
  4.   }
  5. }
no observations
no observations
no observations
no observations
no observations
no observations
no observations
no observations
no observations
no observations
no observations
no observations
no observations
no observations
no observations

     Anteil |
   Roemisch |
katholische |
  Einwohner |
       in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |          4      100.00      100.00
------------+-----------------------------------
      Total |          4      100.00

     Anteil |
   Sonstige |
Konfessione |
        n + |
Konfessions |
  lose in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         27      100.00      100.00
------------+-----------------------------------
      Total |         27      100.00
no observations
no observations

Arbeitslose |
 nindex von |
Gesamtdeuts |
     chland |
  (BRD=100) |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      3,322      100.00      100.00
------------+-----------------------------------
      Total |      3,322      100.00

Arbeitslose |
 nindex von |
 West- bzw. |
Ostdeutschl |
        and |
(Westdtschl |
   . = 100, |
 Ostdtschl. |
          = |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      3,322      100.00      100.00
------------+-----------------------------------
      Total |      3,322      100.00

Arbeitslose |
     nquote |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      3,322      100.00      100.00
------------+-----------------------------------
      Total |      3,322      100.00

     Anzahl |
  Einwohner |
     gesamt |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |          3      100.00      100.00
------------+-----------------------------------
      Total |          3      100.00

     Anzahl |
  Einwohner |
  maennlich |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         24      100.00      100.00
------------+-----------------------------------
      Total |         24      100.00

     Anzahl |
  Einwohner |
   weiblich |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         20      100.00      100.00
------------+-----------------------------------
      Total |         20      100.00
no observations
no observations

Kaufkraft-I |
       ndex |
bezogen auf |
die gesamte |
Bundesrepub |
        lik |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         11      100.00      100.00
------------+-----------------------------------
      Total |         11      100.00
no observations
no observations

Kaufkraft-I |
       ndex |
bezogen auf |
  die Alten |
  und Neuen |
Bundeslaend |
         er |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         11      100.00      100.00
------------+-----------------------------------
      Total |         11      100.00
no observations

durchschnit |
     tliche |
  Kaufkraft |
  pro HH in |
        dem |
PLZ8-Gebiet |
    in Euro |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         11      100.00      100.00
------------+-----------------------------------
      Total |         11      100.00

Kaufkraft-A |
  nteil pro |
    PLZ8 in |
   Promille |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         19      100.00      100.00
------------+-----------------------------------
      Total |         19      100.00

Kaufkraft-S |
    umme in |
  Euro fuer |
        das |
PLZ8-Gebiet |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         11      100.00      100.00
------------+-----------------------------------
      Total |         11      100.00

 Anteil der |
  Einwohner |
   suedlich |
 der Sahara |
       in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     65,195      100.00      100.00
------------+-----------------------------------
      Total |     65,195      100.00

 Anteil der |
  Einwohner |
Sued-/Ost-/ |
Suedostasie |
    ns in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     67,561      100.00      100.00
------------+-----------------------------------
      Total |     67,561      100.00

 Anteil der |
  Einwohner |
    aus dem |
Balkangebie |
     t in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     18,427      100.00      100.00
------------+-----------------------------------
      Total |     18,427      100.00
no observations

 Anteil der |
  Einwohner |
        aus |
Griechenlan |
     d in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     24,459      100.00      100.00
------------+-----------------------------------
      Total |     24,459      100.00

 Anteil der |
  Einwohner |
        aus |
aussereurop |
          . |
islamischen |
 Staaten in |
          % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     48,403      100.00      100.00
------------+-----------------------------------
      Total |     48,403      100.00

 Anteil der |
  Einwohner |
aus Italien |
       in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     10,087      100.00      100.00
------------+-----------------------------------
      Total |     10,087      100.00

 Anteil der |
  Einwohner |
        aus |
  Osteuropa |
       in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     15,866      100.00      100.00
------------+-----------------------------------
      Total |     15,866      100.00

 Anteil der |
  Einwohner |
         an |
Spaetaussie |
  dlern aus |
        der |
  frueheren |
Sowjetunion |
       in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     44,489      100.00      100.00
------------+-----------------------------------
      Total |     44,489      100.00

 Anteil der |
  Einwohner |
        aus |
Spanien/Por |
tugal/Latei |
namerika in |
          % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     40,405      100.00      100.00
------------+-----------------------------------
      Total |     40,405      100.00

 Anteil der |
  Einwohner |
    aus der |
 Tuerkei in |
          % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     19,072      100.00      100.00
------------+-----------------------------------
      Total |     19,072      100.00

 Anteil der |
   uebrigen |
  Einwohner |
       in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      3,786      100.00      100.00
------------+-----------------------------------
      Total |      3,786      100.00
no observations
no observations

          dominantes Migranten-Milieu |      Freq.     Percent      
>   Cum.
--------------------------------------+-----------------------------
> ------
   Haeuser ohne Migrationshintergrund |      2,916      100.00      
> 100.00
--------------------------------------+-----------------------------
> ------
                                Total |      2,916      100.00

 Anzahl der |
Migrantenha |
    ushalte |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      2,933      100.00      100.00
------------+-----------------------------------
      Total |      2,933      100.00
no observations
no observations
no observations
no observations
no observations

Prozentante |
     il der |
      ueber |
25-jaehrige |
          n |
 Akademiker |
   an allen |
   Personen |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         17      100.00      100.00
------------+-----------------------------------
      Total |         17      100.00
no observations
no observations
no observations

Arbeitslose |
 nindex von |
Gesamtdeuts |
     chland |
  (BRD=100) |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      2,053      100.00      100.00
------------+-----------------------------------
      Total |      2,053      100.00

Arbeitslose |
 nindex von |
 West- bzw. |
Ostdeutschl |
        and |
(Westdtschl |
   . = 100, |
 Ostdtschl. |
          = |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      2,046      100.00      100.00
------------+-----------------------------------
      Total |      2,046      100.00

Arbeitslose |
     nquote |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      2,385      100.00      100.00
------------+-----------------------------------
      Total |      2,385      100.00

     Anzahl |
  Einwohner |
  maennlich |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |          1      100.00      100.00
------------+-----------------------------------
      Total |          1      100.00
no observations
no observations
no observations
no observations
no observations
no observations
no observations
no observations
no observations
no observations
no observations

 Anteil der |
  Einwohner |
   suedlich |
 der Sahara |
       in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     87,429      100.00      100.00
------------+-----------------------------------
      Total |     87,429      100.00

 Anteil der |
  Einwohner |
Sued-/Ost-/ |
Suedostasie |
    ns in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |    113,160      100.00      100.00
------------+-----------------------------------
      Total |    113,160      100.00

 Anteil der |
  Einwohner |
    aus dem |
Balkangebie |
     t in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     20,224      100.00      100.00
------------+-----------------------------------
      Total |     20,224      100.00
no observations

 Anteil der |
  Einwohner |
        aus |
Griechenlan |
     d in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     23,527      100.00      100.00
------------+-----------------------------------
      Total |     23,527      100.00

 Anteil der |
  Einwohner |
        aus |
aussereurop |
          . |
islamischen |
 Staaten in |
          % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     70,557      100.00      100.00
------------+-----------------------------------
      Total |     70,557      100.00

 Anteil der |
  Einwohner |
aus Italien |
       in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     10,076      100.00      100.00
------------+-----------------------------------
      Total |     10,076      100.00

 Anteil der |
  Einwohner |
        aus |
  Osteuropa |
       in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     15,175      100.00      100.00
------------+-----------------------------------
      Total |     15,175      100.00

 Anteil der |
  Einwohner |
         an |
Spaetaussie |
  dlern aus |
        der |
  frueheren |
Sowjetunion |
       in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     58,330      100.00      100.00
------------+-----------------------------------
      Total |     58,330      100.00

 Anteil der |
  Einwohner |
        aus |
Spanien/Por |
tugal/Latei |
namerika in |
          % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     48,744      100.00      100.00
------------+-----------------------------------
      Total |     48,744      100.00

 Anteil der |
  Einwohner |
    aus der |
 Tuerkei in |
          % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     23,241      100.00      100.00
------------+-----------------------------------
      Total |     23,241      100.00

 Anteil der |
   uebrigen |
  Einwohner |
       in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      2,789      100.00      100.00
------------+-----------------------------------
      Total |      2,789      100.00
no observations
no observations

          dominantes Migranten-Milieu |      Freq.     Percent      
>   Cum.
--------------------------------------+-----------------------------
> ------
   Haeuser ohne Migrationshintergrund |      8,313      100.00      
> 100.00
--------------------------------------+-----------------------------
> ------
                                Total |      8,313      100.00

 Anzahl der |
Migrantenha |
    ushalte |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      8,313      100.00      100.00
------------+-----------------------------------
      Total |      8,313      100.00
no observations
no observations
no observations
no observations
no observations
no observations
no observations
no observations
no observations

Prozentante |
         il |
  Mieter-HH |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |          1      100.00      100.00
------------+-----------------------------------
      Total |          1      100.00

     Anzahl |
Erwerbspers |
onen gesamt |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |          1      100.00      100.00
------------+-----------------------------------
      Total |          1      100.00
no observations

 Anteil der |
erwerbslose |
 n Personen |
   an allen |
Erwerbspers |
  onen in % |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |          4      100.00      100.00
------------+-----------------------------------
      Total |          4      100.00

. 
. * Drop observations without PLZ information
. drop if missing(pl_id) & missing(plz)
(33 observations deleted)

. replace plz = pl_id if missing(plz)
(0 real changes made)

. 
. * Rename variables
. rename hid hh_id

. rename syear year

. 
. ******************************************************************
> **************
. *** Recodes
. ******************************************************************
> **************
. 
. * Harmonize MZ/P8 Variables
. global mzp8_vars = "alq_p_quote kkr_i_proeinwbrd kkr_i_proeinwwo "

. global mzp8_vars = "$mzp8_vars kkr_w_proeinw met_p_afrika met_p_as
> ien "

. global mzp8_vars = "$mzp8_vars met_p_balkan met_p_deutschl met_p_g
> riechen "

. global mzp8_vars = "$mzp8_vars met_p_islam met_p_italien met_p_ost
> europ met_p_spaetaus "

. global mzp8_vars = "$mzp8_vars met_p_spanport met_p_tuerkei met_p_
> uebrige  mlp_k_statuslp "

. global mzp8_vars = "$mzp8_vars mmo_k_fluktu mmo_k_saldo mmo_k_volu
> men "

. global mzp8_vars = "$mzp8_vars mmm_w_mighaush"

. 
. global p8_vars   = "muc_p_akademik mwo_p_eigentum mwo_p_mieter "

. global p8_vars   = "$p8_vars erp_p_ewtaetige erp_p_ewlose"

. 
. foreach var of global mzp8_vars {
  2.   cap drop nbh_`var'
  3.   clonevar nbh_`var' = mz_`var'
  4.   replace  nbh_`var' = p8_`var' if year > 2009
  5. }
(226,361 missing values generated)
(198,028 real changes made)
(171,524 missing values generated)
(209,027 real changes made)
(171,524 missing values generated)
(208,947 real changes made)
(239,631 missing values generated)
(209,406 real changes made)
(186,217 missing values generated)
(185,684 real changes made)
(186,217 missing values generated)
(184,448 real changes made)
(186,217 missing values generated)
(194,907 real changes made)
(186,217 missing values generated)
(199,192 real changes made)
(186,217 missing values generated)
(194,353 real changes made)
(186,217 missing values generated)
(187,913 real changes made)
(186,217 missing values generated)
(196,291 real changes made)
(186,217 missing values generated)
(195,500 real changes made)
(186,217 missing values generated)
(189,626 real changes made)
(186,217 missing values generated)
(191,269 real changes made)
(186,217 missing values generated)
(195,762 real changes made)
(186,217 missing values generated)
(196,502 real changes made)
(265,146 missing values generated)
(175,018 real changes made)
(171,535 missing values generated)
(198,658 real changes made)
(171,535 missing values generated)
(192,616 real changes made)
(171,535 missing values generated)
(186,631 real changes made)
(239,614 missing values generated)
(203,566 real changes made)

. 
. foreach var of global p8_vars {
  2.   cap drop nbh_`var'
  3.   clonevar nbh_`var' = p8_`var'
  4. }
(121,411 missing values generated)
(189,261 missing values generated)
(189,261 missing values generated)
(189,261 missing values generated)
(189,261 missing values generated)

. 
. * Select relevant variables
. keep hh_id year micyear bula kkz gkz plz pl_id mz_id p8_id gk_id /
> //
>      gtyp kr_kkz_rek ha_mso_k_status nbh_*

.      
. /* 
> Notes: Variable availablity by year
> 
> 2014-2018       nbh_mwo_p_eig~m         Prozentanteil HH mit Wohne
> igentum
> 2014-2018       nbh_mwo_p_mie~r         Prozentanteil Mieter-HH
> 2014-2018       nbh_erp_p_ewt~e         Anteil der erwerbst�tigen 
> Personen an allen Erwerbspersonen in %
> 2014-2018       nbh_erp_p_ewl~e         Anteil der erwerbslosen Pe
> rsonen an allen Erwerbspersonen in %
> 2013-2018       nbh_muc_p_aka~k         Prozentanteil der ueber 25
> -jaehrigen Akademiker an allen Personen
> 2010, 2012-2018 nbh_mlp_k_statuslp      microm Lebensphase nach so
> ziooekonomischem Status
> 2010-2018       nbh_mmm_w_mig~h         Anzahl der Migrantenhausha
> lte
> 2010-2018       nbh_mmm_w_mig~h         Kaufkraft pro Einwohner
> 2009-2018       nbh_alq_p_quote         Arbeitslosenquote
> 2006-2018       nbh_met_p_*             Anteil der Einwanderer aus
>  *
> 2005-2018       nbh_mmo_k_flu~u         Fluktuation
> 2005-2018       nbh_mmo_k_saldo         Umzugssaldo
> 2005-2018       nbh_mmo_k_vol~n         Umzugsvolumen
> 2005-2018       ha_mso_k_status         Status
> */
. 
. * Recode percentages * 100 to proportions
. foreach var of varlist *_p_* {
  2.   replace `var' = `var' / 10000
  3. }
(231,429 real changes made)
(151,700 real changes made)
(127,261 real changes made)
(244,675 real changes made)
(275,156 real changes made)
(236,157 real changes made)
(179,810 real changes made)
(259,530 real changes made)
(250,539 real changes made)
(193,460 real changes made)
(203,651 real changes made)
(241,509 real changes made)
(270,059 real changes made)
variable nbh_muc_p_akademik was int now float
(169,973 real changes made)
variable nbh_mwo_p_eigentum was int now float
(102,123 real changes made)
variable nbh_mwo_p_mieter was int now float
(102,122 real changes made)
variable nbh_erp_p_ewtaetige was int now float
(102,123 real changes made)
variable nbh_erp_p_ewlose was int now float
(102,119 real changes made)

. 
. * Status irrespective of life cycle
. gen     nbh_mlp_k_status = .
(291,384 missing values generated)

. replace nbh_mlp_k_status = 1 ///
>         if inlist(nbh_mlp_k_statuslp, 1, 4, 7, 10, 13, 16, 19, 22,
>  25)
(46,486 real changes made)

. replace nbh_mlp_k_status = 2 ///
>         if inlist(nbh_mlp_k_statuslp, 2, 5, 8, 11, 14, 17, 20, 23,
>  26)    
(115,259 real changes made)

. replace nbh_mlp_k_status = 3 ///
>         if inlist(nbh_mlp_k_statuslp, 3, 6, 9, 12, 15, 18, 21, 24,
>  27)  
(34,477 real changes made)

.      
.      
. ******************************************************************
> **************
. *** Save data
. ******************************************************************
> **************
. 
. * Household-level (N = 291384)
. saveold $savepath/microm_2005_2018.dta, replace v(12)
(saving in Stata 12 format, which can be read by Stata 11 or 12)
  note: variable label "Anteil der erwerbst�tigen Personen an
        allen Erwerbspersonen in %" contains unicode and thus may
        not display well in Stata 13.
file
    /home/dcohen/work/202410_rents_replication//dat/proc-data//mic
    > rom_2005_2018.dta saved

. 
. * House-level (N = 210631)
. drop hh_id

. duplicates drop

Duplicates in terms of all variables

(80,753 observations deleted)

. saveold $savepath/microm_2005_2018_ha.dta, replace v(12)
(saving in Stata 12 format, which can be read by Stata 11 or 12)
  note: variable label "Anteil der erwerbst�tigen Personen an
        allen Erwerbspersonen in %" contains unicode and thus may
        not display well in Stata 13.
file
    /home/dcohen/work/202410_rents_replication//dat/proc-data//mic
    > rom_2005_2018_ha.dta saved

. 
. 
. * Neighboorhood-level (N = 168654)
. drop ha_*

. duplicates drop

Duplicates in terms of all variables

(41,977 observations deleted)

. saveold $savepath/microm_2005_2018_nbh.dta, replace v(12)
(saving in Stata 12 format, which can be read by Stata 11 or 12)
  note: variable label "Anteil der erwerbst�tigen Personen an
        allen Erwerbspersonen in %" contains unicode and thus may
        not display well in Stata 13.
file
    /home/dcohen/work/202410_rents_replication//dat/proc-data//mic
    > rom_2005_2018_nbh.dta saved

. 
. log close
      name:  <unnamed>
       log:  /home/dcohen/work/202410_rents_replication/logs/01-02.l
> og
  log type:  text
 closed on:  18 Oct 2024, 14:18:13
--------------------------------------------------------------------
